<!--
	作者：2575202388@qq.com
	时间：2018-10-14
	描述：分类搜索
-->
<template>
    <div style="width:100%;"> 
        <Tetable ref="tdtable" height="450" :columns="columns9" type="post" :paramiters="tj" :serverUrl="serverUrl"></Tetable>
        <edit ref="edit" v-on:reload="load()" :editparam="editparam"></edit>
    </div> 
</template>
<script>
	import EditDelLook from "./EditDelLook";
	import edit from "./edit";
    export default {
    	name: "sjflss",
    	props: {
    		tj:{
    			type: Object
    		},	
    	},
        data () {
            return {
            	serverUrl:"/host/readbook/sjfl/Search_bookclass.html",
                columns9: [
                    {
                        type: 'index',
                        width: 60,
                        title: '序号',
                        align: 'center'
                    },{
                        title: '上级分类名称',
                        key: 'PCLASSNAME',
                        align: 'center',
                    },{
                        title: '分类名称',
                        key: 'CLASSNAME',
                        align: 'center', 
                    },      
                    {
                        title: '操作',
                        key: 'action',
                        width: 200,
                        align: 'center',
                        render: (h, params) => {
                            return h(EditDelLook, {
                            	on: {
                                    //修改分类
                                    edit: () => {
                                    	const rows=params.row;
                                    	this.editparam={
                                    		classid:rows.CLASSID, 
											pid:rows.PID, 
											classname:rows.CLASSNAME,  
                                    	}
                                        this.$refs.edit.openmodal();
                                    },
                                    //删除分类
                                    remove: () =>{
                                    	const rows=params.row;
                                        this.remove(rows.CLASSID)
                                    },
                                    
                                }
                            });
                        }
                    }
                ],
                editparam:{}
            }
        },
        computed: {
		},
		methods: {
			//删除分类
			remove:function(classid){
                this.$Modal.confirm({
                    title: '警告',
                    content: '请确定是否删除！！！',
                    onOk: () => {
                    	//执行删除代码
                    	this.$http.get("/host/readbook/sjfl/del_bookclass.html?classid="+classid)
						.then(datas => {
							if(datas.result){
								//删除成功 刷新页面
								this.$Message.info('删除成功');
								this.$refs.tdtable.load();
							}else{
								//删除成功 刷新页面
								this.$Message.info(datas.msg);
								this.$refs.tdtable.load();
							}
							
						});
                    }
                });
			},
			
			
			load(){
				this.$refs.tdtable.load();
			},


	    },
		mounted() {
		},
		watch:{
		},
		components: {
			EditDelLook,
			edit
		}
    }
</script>


<style scoped="scoped">
	
	.ivu-table-wrapper {
		border:none;
	}
	
	.toolstipdiv{
		width: '100%';
		overflow: 'hidden';
		textOverflow: 'ellipsis';
		whiteSpace: 'normal';
		wordBreak: 'break-all';
		color:'#fff';
		text-align: center;
	}
	.toolstipdiv:hover{
		background:rgb(63, 193, 201);
	}
	
	.ivu-tooltip-rel label:hover{
		color:#0023FB;
	}
	
	.tablediv{
		height: '40px';
		overflow:'hidden';
		line-height: '40px';
	}
</style>



